<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Heart Animation</title>
  <!-- 引用渐变艺术字体 -->
  <link href="https://fonts.googleapis.com/css2?family=Grandstander:wght@800&display=swap" rel="stylesheet">
  <style>
    /* 基础样式重置 */
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    body {
      overflow: hidden;
      background: #000;
      position: relative;
      color: white;
    }

    /* 爱心基本结构 */
    .heart {
      position: absolute;
      width: 15px;
      height: 15px;
      transform: rotate(-45deg);
      animation: pulse 1.2s infinite ease-in-out;
    }

    /* 爱心伪元素构建 */
    .heart::before,
    .heart::after {
      content: "";
      position: absolute;
      width: 100%;
      height: 100%;
      background: #ff69b4;
      border-radius: 50%;
      opacity: 0.7;
    }

    /* 左侧圆心 */
    .heart::before {
      top: -7.5px;
      left: 0;
    }

    /* 右侧圆心 */
    .heart::after {
      left: 7.5px;
      top: 0;
    }

    /* 爱心脉冲动画 */
    @keyframes pulse {
      0%, 100% {
        transform: rotate(-45deg) scale(1);
        opacity: 0.8;
      }
      50% {
        transform: rotate(-45deg) scale(1.5);
        opacity: 1;
      }
    }

    /* 中心文字样式 */
    .text {
      position: fixed;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      font-family: 'Grandstander', cursive;
      font-size: 48px;
      text-align: center;
      color: #87CEFA;
      animation: glow 2s infinite ease-in-out;
      text-shadow: 0 0 5px #87CEFA, 0 0 10px #87CEFA;
    }

    /* 文字光晕动画 */
    @keyframes glow {
      0%, 100% {
        text-shadow: 0 0 5px #87CEFA, 0 0 10px #87CEFA;
      }
      50% {
        text-shadow: 0 0 10px #87CEFA, 0 0 20px #87CEFA;
      }
    }
  </style>
</head>
<body>
  <!-- 动态文字 -->
  <h1 class="text">I LOVE U</h1>
  
  <!-- 动态心形脚本 -->
  <script>
    // 动态生成100颗心
    const heartCount = 100;
    const hearts = [];

    // 心形随机生成函数
    function createHeart() {
      const heart = document.createElement('div');
      heart.className = 'heart';
      
      // 随机位置
      heart.style.left = `${Math.random() * 100}vw`;
      heart.style.top = `${Math.random() * 100}vh`;
      
      // 随机动画延迟
      const speed = 0.8 + Math.random() * 0.7;
      heart.style.animationDuration = speed + 's';
      heart.style.opacity = 0.5 + Math.random() * 0.5;
      
      document.body.appendChild(heart);
      hearts.push(heart);
    }

    // 初始化生成
    for (let i = 0; i < heartCount; i++) {
      createHeart();
    }
  </script>
</body>
</html>